Telegram Group & Telegram Channel
Одноразовый метод в классе

В случае, если вдруг понадобится в классе функция, которая будет использоваться всего один раз, после чего будет использоваться другая функция, можно воспользоваться приемом на картинке.

Последней строчкой метода call является переопределение самого этого метода на другой, а именно normal_call. Таким образом, изначальный код call будет исполнен только один раз.

Подобный прием будет полезен в тех случаях, когда при самом первом вызове метода в классе требуются выполнить одноразовые действия, которые в дальнейшем не нужны.

#классы #функции



tg-me.com/python_academy/906
Create:
Last Update:

Одноразовый метод в классе

В случае, если вдруг понадобится в классе функция, которая будет использоваться всего один раз, после чего будет использоваться другая функция, можно воспользоваться приемом на картинке.

Последней строчкой метода call является переопределение самого этого метода на другой, а именно normal_call. Таким образом, изначальный код call будет исполнен только один раз.

Подобный прием будет полезен в тех случаях, когда при самом первом вызове метода в классе требуются выполнить одноразовые действия, которые в дальнейшем не нужны.

#классы #функции

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/906

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Telegram and Signal Havens for Right-Wing Extremists

Since the violent storming of Capitol Hill and subsequent ban of former U.S. President Donald Trump from Facebook and Twitter, the removal of Parler from Amazon’s servers, and the de-platforming of incendiary right-wing content, messaging services Telegram and Signal have seen a deluge of new users. In January alone, Telegram reported 90 million new accounts. Its founder, Pavel Durov, described this as “the largest digital migration in human history.” Signal reportedly doubled its user base to 40 million people and became the most downloaded app in 70 countries. The two services rely on encryption to protect the privacy of user communication, which has made them popular with protesters seeking to conceal their identities against repressive governments in places like Belarus, Hong Kong, and Iran. But the same encryption technology has also made them a favored communication tool for criminals and terrorist groups, including al Qaeda and the Islamic State.

The messaging service and social-media platform owes creditors roughly $700 million by the end of April, according to people briefed on the company’s plans and loan documents viewed by The Wall Street Journal. At the same time, Telegram Group Inc. must cover rising equipment and bandwidth expenses because of its rapid growth, despite going years without attempting to generate revenue.

Python Academy from br


Telegram Python Academy
FROM USA